{% extends "base.html" %}
<title>{% block head_title %}{{ page_title }}{% endblock %}</title>
{% block breadcrumb %}
{% endblock %}
{% block index %}
	 {% if items %}
    {% load humanize %}
    <div class="row">
	  <div class="col-md-4">
	    <div class="alert alert-info">Total de Avisos encontrados <strong>{{ totalAdds }}</strong></div>
	  </div>
	  <div class="col-md-4">
	  	<div class="alert alert-success">
		  <strong>Quiero </strong> <a href="{{site.name}}/publisher" class="alert-link">PUBLICAR AQUI!!!</a>
		</div>
	  </div>
	  <div class="col-md-4">
	  	<div class="alert alert-success">
		  <strong>Quiero </strong> <a href="{{site.name}}/publisher" class="alert-link">PUBLICAR AQUI!!!</a>
		</div>
	  </div>
	</div>
	
	<table id="some_id"  class="table table-striped">   
	<tbody>
	    {% for item in items %}
	    <tr>
	    	<td>
	    		<p>
	    		<h4>
		    		<div class="alert alert-info"><a  href="{{item.url}}" target="_blank">{{item.title}}</a></div>
    			</h4>
    			</p>
    			<p class="lead">{{item.category}} ( {{item.creation_date}} )</p>
    			<blockquote><p class="controls-row">{{item.abbreviate_text}}</p></blockquote>
	    		<p><button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#{{forloop.counter}}">Ver Aviso</button></p>
	    	<!-- Modal -->
			<div class="modal fade" id="{{forloop.counter}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			  <div class="modal-dialog">
			    <div class="modal-content">
			      <div class="modal-header">
			        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			        <h4 class="modal-title" id="myModalLabel">{{item.title}}</h4>
			      </div>
			      <div class="modal-body">
			        <blockquote class="pull-right"><p class="controls-row">{{item.full_text}} ....</p></blockquote>
			      </div>
			      <div class="modal-footer">
			        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
			        <a  class="btn btn-default" role="button" href="{{item.url}}" target="_blank">Ir al Aviso</a></button>
			      </div>
			    </div><!-- /.modal-content -->
			  </div><!-- /.modal-dialog -->
			</div><!-- /.modal -->
	    	</td>
	    </tr>
	    {% endfor %}
	</tbody>
	</table>
	<ul class="pagination pagination-lg">
	    <li>
	        {% if items.has_previous %}
	            <a href="?page={{ items.previous_page_number }}">Previa</a>
	        {% endif %}
	
	        <span class="current">
	            Pagina {{ items.number }} de {{ items.paginator.num_pages }}.
	        </span>
	
	        {% if items.has_next %}
	            <a href="?page={{ items.next_page_number }}">Sgte</a>
	        {% endif %}
	    </li>
	</ul>
	{% else %}
	<h3>No existen avisos para la busqueda realizada.</h3>
	{% endif %}

{% endblock %}
 
